define(function(require){
  const THREE = require('three')
  const $=require('jquery')
  let $cont = $(".web-small")
  function init(){
      var height = window.innerHeight * 215 / 1080
      var width  = height
      var loader = new THREE.TextureLoader();
      var scene = new THREE.Scene();
      var camera = new THREE.PerspectiveCamera(30, width / height, 1, 10000);
      camera.position.z = 900;
      var renderer = new THREE.WebGLRenderer({antialias: true, alpha: true});
      renderer.setSize(width, height);
      var light = new THREE.DirectionalLight(0xffffff, 1);
      light.position.set(0, 0 , 500);
      scene.add(light);
      //地球
      var material = new THREE.MeshPhongMaterial({
        map: loader.load('img/main-block-1-global-world.png')
      })
      material.transparent = true
      var earth = new THREE.Mesh(
        new THREE.SphereGeometry(200, 32, 32),
        material
      )
      scene.add(earth)

      //动画循环
      function render() {
        earth.rotation.y += 0.005;
        renderer.render(scene, camera);
        requestAnimationFrame(render);
      }
      render()
      $cont.append(renderer.domElement);
    }
    var add=function(x,y){
      return x+y
    }
      return{
        init:init,
        add:add
      }
  
})